<div class="layui-fluid" id="VIEW-list-table" lay-title="多语言列表" lig-title="lang-title">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header" lig-lang="label-searchTitle">筛选数据</div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="lig-language-searchform">
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" lig-lang="lang-constant">类别</label>
                                <div class="layui-inline">
                                    <select name="constant">
                                        <option value=""></option>
                                        <option value="res">菜单按钮</option>
                                        <option value="msg">提示语</option>
                                        <option value="label" selected>页面标题</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" lig-lang="lang-languageCode">编码</label>
                                <div class="layui-inline">
                                    <input type="text" class="layui-input" name="languageCode" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" lig-lang="lang-languageZhCn">中文名称</label>
                                <div class="layui-inline">
                                    <input type="text" class="layui-input" name="languageZhCn" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-row layui-col-space10">
                                    <div class="layui-col-xs6">
                                        <div class="layui-btn layui-btn-sm layui-btn-fluid" lay-filter="lig-language-search" lig-lang="btn-search">查询</div>
                                    </div>
                                    <div class="layui-col-xs6">
                                        <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary" lig-lang="btn-reset">重置</button></div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body nepadmin-table-full">
                    <div class="layui-btn-container nepadmin-pad-t10 nepadmin-pad-l10">
                        <div class="layui-btn layui-btn-sm" lay-filter="lig-language-add" lig-lang="btn-addLanguage">添加多语言</div>
                    </div>
                    <table lay-filter="lig-language-table"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="tpl-row-toolBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="lig-modify" lay-filter="lig-language-modify" lig-lang="btn-modify">修改</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="lig-delete" lay-filter="lig-language-delete" lig-lang="btn-delete">删除</a>
</script>
<script type="text/html" id="tpl-language-add">
    <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveForm">
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="lang-constant">类型</label>
            <div class="layui-input-block">
                <select name="constant" lay-verify="required">
                    <option value=""></option>
                    <option value="msg">提示语</option>
                    <option value="label">页面标题</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="lang-languageCode">编码</label>
            <div class="layui-input-block">
                <input type="text" name="languageCode" autocomplete="off" class="layui-input" lay-verify="required"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="lang-languageZhCn">中文</label>
            <div class="layui-input-block">
                <input type="text" name="languageZhCn" autocomplete="off" class="layui-input"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="lang-languageEnUs">英文</label>
            <div class="layui-input-block">
                <input type="text" name="languageEnUs" autocomplete="off" class="layui-input"
                        value=''>
            </div>
        </div>
    </form>
</script>
<script type="text/html" id="tpl-language-modify">
    <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveForm">
        <input type="hidden" name="languageId" value="{{d.languageId}}"/>
        <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveform">
            <div class="layui-form-item">
                <label class="layui-form-label ligui-form-item-required" lig-lang="lang-languageCode">编码</label>
                <div class="layui-input-block">
                    <input type="text" name="languageCode" autocomplete="off" class="layui-input layui-disabled" disabled
                           value='{{d.languageCode}}'>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" lig-lang="lang-languageZhCn">中文</label>
                <div class="layui-input-block">
                    <input type="text" name="languageZhCn" autocomplete="off" class="layui-input"
                           value='{{d.languageZhCn}}'>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" lig-lang="lang-languageEnUs">英文</label>
                <div class="layui-input-block">
                    <input type="text" name="languageEnUs" autocomplete="off" class="layui-input"
                           value='{{d.languageEnUs}}'>
                </div>
            </div>
        </form>
    </form>
</script>
<script>
    layui.use(['admin', 'table', 'form', 'dropdown', 'laytpl', 'jquery','lig'], function (admin, table, form, dropdown, laytpl, $, lig) {
        form.render();

        // 实例代码，加载字典项
        lig.loadSelectDict('sku_splb', '[lay-filter="lig-language-searchform"] select[name="splb"]');

        lig.table({
            elem: '[lay-filter="lig-language-table"]',
            url: 'setting/language/page',
            cols: [[
                { title: '<span lig-lang="label-opt">操作</span>', toolbar: '#tpl-row-toolBar', align: 'left', width: 120, fixed: 'left'},
                { title: '<span lig-lang="lang-languageCode">编码</span>', field: 'languageCode', minWidth: 120 },
                { title: '<span lig-lang="lang-languageZhCn">中文</span>', field: 'languageZhCn', minWidth: 120 },
                { title: '<span lig-lang="lang-languageEnUs">英文</span>', field: 'languageEnUs', minWidth: 120 }

            ]]
        },{
            mode:'dialog',
            entity: 'language',
            primaryField: 'languageId',
            addContent: $('#tpl-language-add').html(),
            addUrl: 'setting/language/add',
            addTitle: '<span lig-lang="lang-addLanguage">添加多语言</span>',
            area: ['50%', 'auto'],
            onAddOpened: function() {
            },

            modifyContent: $('#tpl-language-modify').html(),
            modifyUrl: 'setting/language/modify',
            modifyTitle: '<span lig-lang="lang-modifyLanguage">修改多语言</span>',
            area: ['50%', 'auto'],
            onModifyOpened: function() {
            },

            removeUrl: 'setting/language/remove',
            getUrl: 'setting/language/{languageId}'
        });

    })
</script>